home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Technotools
/
Technotools (Chestnut CD-ROM)(1993).ISO
/
editors
/
tscredd2
/
scrdisk5.exe
/
arc
/
DEMOWIND.C
next >
Wrap
Text File
|
1990-04-16
|
53KB
|
2,224 lines
#include <dos.h>
#include <stdlib.h>
#include <conio.h>
#include <ctype.h>
#include "scredit.h"
#include "windows.h"
struct {
unsigned char
MenuLiteBg,
MenuLiteFg,
MenuNameBg,
MenuNameFg,
MenuBorderBg,
MenuBorderFg,
MenuTextBg,
MenuTextFg,
MenuSelectBg,
MenuSelectFg,
MenuErrorBg,
MenuErrorFg,
MenuBarBg,
MenuBarFg,
PopUpBorderBg,
PopUpBorderFg,
PopUpTextBg,
PopUpTextFg,
PopUpFootBg,
PopUpFootFg,
PopUpBarBg,
PopUpBarFg,
ChgNameBg,
ChgNameFg,
ChgNamePos,
ChgBorderBg,
ChgBorderFg,
ChgBorderStyle,
ChgFootBg,
ChgFootFg,
ChgFootPos,
ChgTextBg,
ChgTextFg;
char
ChgName[31],
ChgFooter[31];
} ConfigRec;
char WorkStr[81],
WindowName[81],
WindowFoot[81],
HoldScreen[4000];
int WindowNo,
WindowRow,
WindowCol,
WindowLength,
WindowLines,
X,Y,Z,
PrevOption,
NewLine,
LastLine,
CurrentCol,
DemoOption,
ColorOption,
MainOption,
OutOfMem,
Menus[100];
unsigned char
BorderStyle,
BorderBg,
BorderFg,
WindowNameBg,
WindowNameFg,
WindowNamePos,
WindowFootBg,
WindowFootFg,
WindowFootPos,
TextBg,
TextFg;
unsigned char
False = 0,
True = 1,
DoMouse = 0,
WindowActive = 0;
#define MenuBarItems 4
char MenuBarSpacing[4] = " ";
char MenuBarStr[81];
char MenuBarFields[MenuBarItems][20] =
{"General Demo",
"Data Entry",
"Color Changes",
"Quit"};
int MenuBarLines[MenuBarItems] = {12,0,4,0};
char DemoMenu[12][30] =
{" Fast video mode is now <OFF>",
" Open & shut 50 windows",
" Moving a window",
" Dragging a window",
" Moving several windows",
" Writing lines to windows",
" Writing with scrollings",
" Reading lines from windows",
" Shuffling windows",
" Popping windows",
" Changing backgrounds",
" Standard I/O"};
char ColorMenu[4][20] = {"Border","Name","Footer","Text"};
void Initialize()
{
if (S_Mono)
{
ConfigRec.MenuLiteBg = 7;
ConfigRec.MenuLiteFg = 0;
ConfigRec.MenuNameBg = 7;
ConfigRec.MenuNameFg = 0;
ConfigRec.MenuBorderBg = 0;
ConfigRec.MenuBorderFg = 7;
ConfigRec.MenuTextBg = 0;
ConfigRec.MenuTextFg = 7;
ConfigRec.MenuBarBg = 0;
ConfigRec.MenuBarFg = 7;
ConfigRec.MenuSelectBg = 7;
ConfigRec.MenuSelectFg = 0;
ConfigRec.PopUpBorderBg = 0;
ConfigRec.PopUpBorderFg = 15;
ConfigRec.PopUpTextBg = 0;
ConfigRec.PopUpTextFg = 7;
ConfigRec.PopUpFootBg = 7;
ConfigRec.PopUpFootFg = 0;
ConfigRec.PopUpBarBg = 7;
ConfigRec.PopUpBarFg = 0;
strcpy(ConfigRec.ChgName,"Name");
strcpy(ConfigRec.ChgFooter,"Footer");
ConfigRec.ChgNameBg = LIGHTGRAY;
ConfigRec.ChgNameFg = BLACK;
ConfigRec.ChgNamePos = 3;
ConfigRec.ChgBorderBg = BLACK;
ConfigRec.ChgBorderFg = WHITE;
ConfigRec.ChgBorderStyle= 3;
ConfigRec.ChgFootBg = LIGHTGRAY;
ConfigRec.ChgFootFg = BLACK;
ConfigRec.ChgFootPos = 3;
ConfigRec.ChgTextBg = BLACK;
ConfigRec.ChgTextFg = WHITE;
}
else
{
ConfigRec.MenuLiteBg = LIGHTGRAY;
ConfigRec.MenuLiteFg = BLUE;
ConfigRec.MenuNameBg = 0;
ConfigRec.MenuNameFg = 0;
ConfigRec.MenuBorderBg = GREEN;
ConfigRec.MenuBorderFg = BLACK;
ConfigRec.MenuTextBg = BLUE;
ConfigRec.MenuTextFg = CYAN;
ConfigRec.MenuBarBg = 0;
ConfigRec.MenuBarFg = 0;
ConfigRec.MenuSelectBg = 0;
ConfigRec.MenuSelectFg = 0;
ConfigRec.PopUpBorderBg = LIGHTGRAY;
ConfigRec.PopUpBorderFg = BLUE;
ConfigRec.PopUpTextBg = BLUE;
ConfigRec.PopUpTextFg = CYAN;
ConfigRec.PopUpFootBg = LIGHTGRAY;
ConfigRec.PopUpFootFg = BLUE;
ConfigRec.PopUpBarBg = LIGHTGRAY;
ConfigRec.PopUpBarFg = BLUE;
strcpy(ConfigRec.ChgName,"Name");
strcpy(ConfigRec.ChgFooter,"Footer");
ConfigRec.ChgNameBg = LIGHTGRAY;
ConfigRec.ChgNameFg = BLACK;
ConfigRec.ChgNamePos = 3;
ConfigRec.ChgBorderBg = BLACK;
ConfigRec.ChgBorderFg = WHITE;
ConfigRec.ChgBorderStyle= 3;
ConfigRec.ChgFootBg = LIGHTGRAY;
ConfigRec.ChgFootFg = BLACK;
ConfigRec.ChgFootPos = 3;
ConfigRec.ChgTextBg = BLACK;
ConfigRec.ChgTextFg = WHITE;
}
}
void RandomWindows(int Count)
{
static int result;
static unsigned char
ColorSets[8][7] =
{3,LIGHTGRAY, BLACK, LIGHTGRAY,WHITE, BLACK,WHITE,
2,BLUE, CYAN, BLUE, WHITE, BLUE, CYAN,
3,BLACK, YELLOW, GREEN, YELLOW, BLACK, YELLOW,
2,GREEN, BLACK, GREEN, YELLOW, GREEN, WHITE,
1,RED, YELLOW, RED, YELLOW, RED, WHITE,
3,BROWN, YELLOW, LIGHTGRAY,WHITE, BROWN, WHITE,
1,MAGENTA, YELLOW, MAGENTA, WHITE, MAGENTA, BLACK,
2,BLUE, BLACK, LIGHTGRAY,BLUE, LIGHTGRAY, BLACK};
OutOfMem = 0;
for (X=0;((X<Count)&&(OutOfMem==0));X++)
{
do {WindowRow = random(21);} while (WindowRow<1);
do {WindowCol = random(60);} while (WindowCol<1);
do {WindowLength = random(80-WindowCol);}
while ((WindowLength <20)||(WindowLength>30));
do {WindowLines = random(9);}
while ((WindowLines <3)||(WindowLines>7));
itoa(X,WorkStr,10);
strcpy(WindowName,"Window");
strcat(WindowName,WorkStr);
do {WindowNamePos= random(3);} while (WindowNamePos<1);
strcpy(WindowFoot,WindowName);
do {WindowFootPos= random(3);} while (WindowFootPos<1);
Y = X%7;
BorderStyle = ColorSets[Y][0];
BorderBg = ColorSets[Y][1];
BorderFg = ColorSets[Y][2];
WindowNameBg = ColorSets[Y][3];
WindowNameFg = ColorSets[Y][4];
WindowFootBg = ColorSets[Y][3];
WindowFootFg = ColorSets[Y][4];
TextBg = ColorSets[Y][5];
TextFg = ColorSets[Y][6];
result = DefineWindow(
WindowRow,WindowCol,WindowLength,WindowLines,
BorderStyle,BorderBg,BorderFg,
WindowName,WindowNameBg,WindowNameFg,WindowNamePos,
WindowFoot,WindowNameBg,WindowNameFg,WindowFootPos,
TextBg,TextFg);
if (result > 0)
Menus[X+3] = result;
else
OutOfMem = X+2;
}
WindowName[0] = 0;
WindowNamePos = 0;
WindowFoot[0] = 0;
WindowFootPos = 0;
}
void BuildOneWindow(int N, int R, int C, int W, int L)
{
WindowRow = R;
WindowCol = C;
WindowLength = W;
WindowLines = L;
BorderStyle = 2;
Menus[N] = DefineWindow(
WindowRow,WindowCol,WindowLength,WindowLines,
BorderStyle,
ConfigRec.PopUpBorderBg,
ConfigRec.PopUpBorderFg,
WindowName,
ConfigRec.PopUpFootBg,
ConfigRec.PopUpFootFg,
WindowNamePos,
WindowFoot,
ConfigRec.PopUpFootBg,
ConfigRec.PopUpFootFg,
WindowFootPos,
ConfigRec.PopUpTextBg,
ConfigRec.PopUpTextFg);
}
void BuildMainMenu()
{
unsigned char LeftA = 27;
unsigned char RightA = 26;
unsigned char UpA = 24;
unsigned char DnA = 25;
MenuBarStr[0] = 0;
for (X=0;X<MenuBarItems;X++)
{
strcat(MenuBarStr,MenuBarSpacing);
strcat(MenuBarStr,MenuBarFields[X]);
}
strcat(MenuBarStr," Mouse:");
if (S_MouseInstalled)
strcat(MenuBarStr,"YES");
else
strcat(MenuBarStr,"NO ");
strcat(MenuBarStr," Use:<ENTER> ");
WorkStr[0] = LeftA;
WorkStr[1] = 32;
WorkStr[2] = RightA;
WorkStr[3] = 0;
strcat(MenuBarStr,WorkStr);
WindowRow = 1;
WindowCol = 1;
WindowLength = 80;
WindowLines = 1;
BorderStyle = 0;
WindowName[0] = 0;
WindowNamePos = 0;
WindowFoot[0] = 0;
WindowFootPos = 0;
Menus[0] = DefineWindow(
WindowRow,WindowCol,WindowLength,WindowLines,
BorderStyle,
ConfigRec.MenuBorderBg,
ConfigRec.MenuBorderFg,
WindowName,
ConfigRec.MenuNameBg,
ConfigRec.MenuNameFg,
WindowNamePos,
WindowFoot,WindowFootBg,WindowFootFg,WindowFootPos,
ConfigRec.MenuTextBg,
ConfigRec.MenuTextFg);
WindowNamePos = 0;
WriteWindowLine("",Menus[0],1,W_Off,0,
ConfigRec.MenuBarBg,
ConfigRec.MenuBarFg,
MenuBarStr);
WindowRow = 2;
WindowCol = (long)strstr(MenuBarStr,MenuBarFields[0])
- (long)&MenuBarStr;
strcpy(WindowFoot,"Use <ENTER> ");
WindowFoot[13] = UpA;
WindowFoot[15] = DnA;
WindowFoot[17] = LeftA;
WindowFoot[19] = RightA;
WindowFootPos = 3;
WindowLength = 30;
WindowLines = 12;
BorderStyle = 3;
Menus[1] = DefineWindow(
WindowRow,WindowCol,WindowLength,WindowLines,
BorderStyle,
ConfigRec.PopUpBorderBg,
ConfigRec.PopUpBorderFg,
"",0,0,0,
WindowFoot,
ConfigRec.PopUpFootBg,
ConfigRec.PopUpFootFg,
WindowFootPos,
ConfigRec.PopUpTextBg,
ConfigRec.PopUpTextFg);
for (X=0;X<12;X++) WriteWindowLine("",Menus[1],X+1,W_Off,0,0,0,DemoMenu[X]);
WindowName[0] = 0;
WindowNamePos = 0;
WindowFoot[0] = 0;
WindowFootPos = 0;
WindowCol = (long)strstr(MenuBarStr,MenuBarFields[2])
- (long)&MenuBarStr;
WindowFoot[0] = 0;
WindowLength = 9;
WindowLines = 4;
BorderStyle = 3;
Menus[2] = DefineWindow(
WindowRow,WindowCol,WindowLength,WindowLines,
BorderStyle,
ConfigRec.PopUpBorderBg,
ConfigRec.PopUpBorderFg,
"",0,0,0,
WindowFoot,
ConfigRec.PopUpFootBg,
ConfigRec.PopUpFootFg,
WindowFootPos,
ConfigRec.PopUpTextBg,
ConfigRec.PopUpTextFg);
for (X=0;X<4;X++) WriteWindowLine("",Menus[2],X+1,W_Off,0,0,0,ColorMenu[X]);
}
void GetNextKey()
{
DoMouse = False;
S_NextKey();
if (S_Ms->MouseEvent)
{
S_AnalizeMouse();
if (S_MsRow == 1)
{
if ((S_MsCol > 3)&&(S_MsCol < 16))
{
DoMouse = True;
MainOption = 0;
if ((CurrentCol > 3)&&(CurrentCol < 16))
S_Enter = True;
else
CurrentCol = S_MsCol;
}
if ((S_MsCol > 18)&&(S_MsCol < 29))
{
DoMouse = True;
MainOption = 1;
if ((CurrentCol > 18)&&(CurrentCol < 29))
S_Enter = True;
else
CurrentCol = S_MsCol;
}
if ((S_MsCol >31)&&(S_MsCol < 45))
{
DoMouse = True;
MainOption = 2;
if ((CurrentCol > 31)&&(CurrentCol < 45))
S_Enter = True;
else
CurrentCol = S_MsCol;
}
if ((S_MsCol > 47)&&(S_MsCol < 52))
{
DoMouse = True;
MainOption = 3;
if ((CurrentCol > 47)&&(CurrentCol < 52))
S_Enter = True;
else
CurrentCol = S_MsCol;
}
}
if (WindowActive)
{
if ((MainOption == 0)&&
((S_MsRow > 2)&&(S_MsRow < 16)) &&
((S_MsCol > 3)&&(S_MsCol < 30)))
{
S_Enter = True;
NewLine = S_MsRow - 2;
}
if ((MainOption == 2) &&
((S_MsRow > 2)&&(S_MsRow < 7))&&
((S_MsCol > 31)&&(S_MsCol < 45)))
{
S_Enter = True;
NewLine = S_MsRow - 2;
}
}
S_ResetMouseFlags();
}
}
void ChangeWindowDemo()
{
char PassStr[81], TextStr[81];
int Row,Col,Typ,Len,
NewValue,
OffSet ,
Pos_Style,
Bg, Fg;
static char Text1[11][41] =
{" This procedure will demonstrate how to",
" change the windows visable attributes:",
"",
" - Change the windows border style and ",
" colors.",
"",
" - Change the Heading and footer text,",
" position, and colors.",
"",
" - Change the Text background and",
" forground colors."};
static char Text2[20][31] =
{"Border",
"",
" Style............(1..3)[ ]",
" BackGround.......(0..7)[ ]",
" ForeGround.......(0.15)[ ]",
"Window Name",
" Text:[ ]",
" Position.........(0..3)[ ]",
" BackGround.......(0..7)[ ]",
" ForeGround.......(0.15)[ ]",
"Window Footer",
" Text:[ ]",
" Position.........(0..3)[ ]",
" BackGround.......(0..7)[ ]",
" ForeGround.......(0.15)[ ]",
"Text",
"",
"",
" BackGround.......(0..7)[ ]",
" ForeGround.......(0.15)[ ]"};
S_HideMouse();
S_SetMouseEvent("00000000");
OffSet = (((LastLine - 1)*5));
Menus[3] =
DefineWindow(7,37,40,11,
ConfigRec.ChgBorderStyle,
ConfigRec.ChgBorderBg,
ConfigRec.ChgBorderFg,
ConfigRec.ChgName,
ConfigRec.ChgNameBg,
ConfigRec.ChgNameFg,
ConfigRec.ChgNamePos,
ConfigRec.ChgFooter,
ConfigRec.ChgFootBg,
ConfigRec.ChgFootFg,
ConfigRec.ChgFootPos,
ConfigRec.ChgTextBg,
ConfigRec.ChgTextFg);
strcpy(WindowName,Text2[OffSet]);
WindowNamePos = 1;
strcpy(WindowFoot,"<ESC> to Quit");
WindowFootPos = 1;
BuildOneWindow(4,11,7,30,4);
WindowName[0] = 0;
WindowNamePos = 0;
WindowFoot[0] = 0;
WindowFootPos = 0;
for (X=0;X<4;X++)
WriteWindowLine("",Menus[4],X+1,W_Off,0,0,0,Text2[OffSet+X+1]);
for (X=0;X<10;X++)
WriteWindowLine("",Menus[3],X+1,W_Off,0,0,0,Text1[X]);
OpenWindow("",Menus[3]);
OpenWindow("",Menus[4]);
X = 1;
do{
switch (LastLine)
{
case 2 : {strcpy(PassStr,ConfigRec.ChgName);break;}
case 3 : {strcpy(PassStr,ConfigRec.ChgFooter);break;}
default: {PassStr[0] = 0;}
}
WriteWindowField("",Menus[4],1,8,9,20,
ConfigRec.PopUpTextBg,ConfigRec.PopUpTextFg,
ConfigRec.PopUpTextBg,ConfigRec.PopUpTextFg,PassStr);
switch (LastLine)
{
case 1 : {itoa(ConfigRec.ChgBorderStyle,PassStr,10);break;}
case 2 : {itoa(ConfigRec.ChgNamePos,PassStr,10);break;}
case 3 : {itoa(ConfigRec.ChgFootPos,PassStr,10);break;}
default: PassStr[0]=0;
}
if (LastLine != 4)
WriteWindowField("",Menus[4],2,26,0,2,
ConfigRec.PopUpTextBg,ConfigRec.PopUpTextFg,
ConfigRec.PopUpTextBg,ConfigRec.PopUpTextFg,PassStr);
switch (LastLine)
{
case 1 : {itoa(ConfigRec.ChgBorderBg,PassStr,10);break;}
case 2 : {itoa(ConfigRec.ChgNameBg,PassStr,10);break;}
case 3 : {itoa(ConfigRec.ChgFootBg,PassStr,10);break;}
case 4 : {itoa(ConfigRec.ChgTextBg,PassStr,10);break;}
}
WriteWindowField("",Menus[4],3,26,0,2,
ConfigRec.PopUpTextBg,ConfigRec.PopUpTextFg,
ConfigRec.PopUpTextBg,ConfigRec.PopUpTextFg,PassStr);
switch (LastLine)
{
case 1 : {itoa(ConfigRec.ChgBorderFg,PassStr,10);break;}
case 2 : {itoa(ConfigRec.ChgNameFg,PassStr,10);break;}
case 3 : {itoa(ConfigRec.ChgFootFg,PassStr,10);break;}
case 4 : {itoa(ConfigRec.ChgTextFg,PassStr,10);break;}
}
WriteWindowField("",Menus[4],4,26,0,2,
ConfigRec.PopUpTextBg,ConfigRec.PopUpTextFg,
ConfigRec.PopUpTextBg,ConfigRec.PopUpTextFg,PassStr);
switch (LastLine)
{
case 1: {
if (X < 3)
{
itoa(ConfigRec.ChgBorderStyle,PassStr,10);
X = 2;
Row = 2;
}
if (X == 3)
{
itoa(ConfigRec.ChgBorderBg,PassStr,10);
Row = 3;
}
if (X == 4)
{
itoa(ConfigRec.ChgBorderFg,PassStr,10);
Row =4;
}
Col = 27;
Typ = 0;
Len = 2;
break;
}
case 2: {
if (X == 1)
{
strcpy(PassStr,ConfigRec.ChgName);
Row = 1;
Col = 9;
Typ = 9;
Len = 20;
}
else
{
if (X == 2)
{
itoa(ConfigRec.ChgNamePos,PassStr,10);
X = 2;
Row = 2;
}
if (X == 3)
{
itoa(ConfigRec.ChgNameBg,PassStr,10);
Row = 3;
}
if (X == 4)
{
itoa(ConfigRec.ChgNameFg,PassStr,10);
Row = 4;
}
Col = 27;
Typ = 0;
Len = 2;
}
break;
}
case 3:{
if (X == 1)
{
strcpy(PassStr,ConfigRec.ChgFooter);
Row = 1;
Col = 9;
Typ = 9;
Len = 20;}
else
{
if (X == 2)
{
itoa(ConfigRec.ChgFootPos,PassStr,10);
X = 2;
Row = 2;
}
if (X == 3)
{
itoa(ConfigRec.ChgFootBg,PassStr,10);
Row = 3;
}
if (X == 4)
{
itoa(ConfigRec.ChgFootFg,PassStr,10);
Row = 4;
}
Col = 27;
Typ = 0;
Len = 2;
}
break;
}
case 4:{
if (X < 4)
{
X = 3;
itoa(ConfigRec.ChgTextBg,PassStr,10);
Row = 3;
}
if (X == 4)
{
itoa(ConfigRec.ChgTextFg,PassStr,10);
Row = 4;
}
Col = 27;
Typ = 0;
Len = 2;
break;
}
}
PauseWindowUpdates(False);
ReadWindowField("",Menus[4],Row,Col,Typ,Len,
ConfigRec.PopUpBarBg,
ConfigRec.PopUpBarFg,
PassStr);
NewValue = atoi(PassStr);
PauseWindowUpdates(True);
switch (LastLine)
{
case 1:{switch (X)
{
case 2 : {ConfigRec.ChgBorderStyle = NewValue;break;}
case 3 : {ConfigRec.ChgBorderBg = NewValue;break;}
case 4 : {ConfigRec.ChgBorderFg = NewValue;break;}
}
break;
}
case 2:{switch (X)
{
case 1 : {strcpy(ConfigRec.ChgName,PassStr); break;}
case 2 : {ConfigRec.ChgNamePos = NewValue; break;}
case 3 : {ConfigRec.ChgNameBg = NewValue; break;}
case 4 : {ConfigRec.ChgNameFg = NewValue; break;}
}
break;
}
case 3:{switch (X)
{
case 1 : {strcpy(ConfigRec.ChgFooter,PassStr);break;}
case 2 : {ConfigRec.ChgFootPos = NewValue;break;}
case 3 : {ConfigRec.ChgFootBg = NewValue;break;}
case 4 : {ConfigRec.ChgFootFg = NewValue;break;}
}
break;
}
case 4:{switch (X)
{
case 3 : {ConfigRec.ChgTextBg = NewValue;break;}
case 4 : {ConfigRec.ChgTextFg = NewValue;break;}
}
break;
}
}
ChangeWindow("",Menus[3],
ConfigRec.ChgBorderStyle,
ConfigRec.ChgBorderBg,
ConfigRec.ChgBorderFg,
ConfigRec.ChgName,
ConfigRec.ChgNameBg,
ConfigRec.ChgNameFg,
ConfigRec.ChgNamePos,
ConfigRec.ChgFooter,
ConfigRec.ChgFootBg,
ConfigRec.ChgFootFg,
ConfigRec.ChgFootPos,
ConfigRec.ChgTextBg,
ConfigRec.ChgTextFg);
if (S_Up)
{
S_Tab = True;
S_Shift = True;
}
if (S_Down)
S_Tab = True;
if (S_Tab)
if (S_Shift) X--; else X++;
switch (LastLine)
{
case 1:{
if (X > 4) X = 2; else if (X < 2) X = 4;
break;
}
case 2:
case 3:{
if (X > 4) X = 1; else if (X < 1) X = 4;
break;
}
case 4:{
if (X > 4) X = 3; else if (X < 3) X = 4;
break;
}
}
}while (!S_Esc);
EraseWindow("",Menus[3]);
EraseWindow("",Menus[4]);
S_ResetKeyFlags();
S_ResetMouseFlags();
S_SetMouseEvent("01000000");
S_ShowMouse();
}
void DataEntryDemo()
{
char PassStr[81];
long Months[12];
long Row, Col, Mth,
Range, Amount;
static char Graph[19][81] =
{" ** 1989 Bakery Sales ** ",
"──────────────────────────────────────────────────────────────────",
" + - - + ",
"G 110,000 - -110,000",
"r - - ",
"o 90,000 - - 90,000",
"s - - ",
"s 70,000 - - 70,000",
" - - ",
"S 50,000 - - 50,000",
"a - - ",
"l 30,000 - - 30,000",
"e - - ",
"s 10,000 - - 10,000",
"──────────────────────────────────────────────────────────────────",
" Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec ",
"──────────────────────────────────────────────────────────────────",
"Jan 120000 Feb 110000 Mar 100000 Apr 90000 May 80000 Jun 70000 ",
"Jul 60000 Aug 50000 Sep 40000 Oct 30000 Nov 20000 Dec 10000 "};
S_HideMouse();
S_SetMouseEvent("00000000");
strcpy(WindowFoot,"<ENTER> = REDraw graph <ESC> = exit");
WindowFootPos = 3;
BuildOneWindow(3,2,4,67,19);
WindowFootPos = 0;
Range = 120000;
OpenWindow("",Menus[3]);
PauseWindowUpdates(False);
for(X=0;X<19;X++){
if (X < 12) Months[X] = Range;
Range -= 10000;
if ((X<2)||(X>13))
WriteWindowLine("",Menus[3],X+1,W_Off,0,0,0,Graph[X]);
else
WriteWindowLine("",Menus[3],X+1,W_Off,0,ConfigRec.PopUpTextBg,15,Graph[X]);}
Row = 18;
Col = 0;
Mth = 0;
PassStr[0]=0;
S_Enter = True;
do{
if (S_Enter){
Range = 110000;
for (X=3;X<15;X++){
for (Y=0;Y<12;Y++){
if (((X==3) && (Months[Y] > Range)) ||
((X>3) && (Months[Y] > Range))){
textcolor(Y+2);
strcpy(PassStr,"▒▒▒");}
else{
strcpy(PassStr," ");
textcolor(15);}
gotoxy(12+(Y*4),X);
cprintf(PassStr);}
Range-=10000;}
}
SaveWindow();
PassStr[0]=0;
ltoa(Months[Mth],PassStr,10);
ReadWindowField("",Menus[3],Row,(Col*11)+5,0,6,7,0,PassStr);
Months[Mth] = atol(PassStr);
if (S_Tab)
{
if (S_Shift)
{
Col--;
Mth--;
if (Col < 0)
{
Col = 5;
Mth = 5;
if (Row == 19)
Row = 18;
else
{
Row = 19;
Mth = 11;
}
}
}
else
{
Col++;
Mth++;
if (Col > 5)
{
Col = 0;
Mth = 0;
if (Row == 19)
Row = 18;
else
{
Row = 19;
Mth = 6;
}
}
}
}
}while (!S_Esc);
EraseWindow("",Menus[3]);
S_ResetKeyFlags();
S_ResetMouseFlags();
S_SetMouseEvent("01000000");
S_ShowMouse();
}
void OpenAndShutFiftyWindows()
{
PauseWindowUpdates(False);
RandomWindows(50);
PopWindow("",Menus[0]);
PopWindow("",Menus[1]);
if (OutOfMem==0) OutOfMem = 52;
for (X=3;X<(OutOfMem+1);X++) OpenWindow("",Menus[X]);
PopWindow("",Menus[OutOfMem]);
ClearWindow("",Menus[OutOfMem],0,0);
if (OutOfMem==52)
cprintf("** Press Any Key To Continue **");
else
cprintf("** Not enough memory for 50 windows..Press any key to continue.");
S_NextKey();
for (X=OutOfMem;X>2;X--) ShutWindow("",Menus[X]);
PauseWindowUpdates(True);
for (X=3;X<(OutOfMem+1);X++)
{
EraseWindow("",Menus[X]);
}
}
void MoveAWindow()
{
BuildOneWindow(3,10,10,40,6);
WriteWindowLine("",Menus[3],1,W_Off,0,0,0,"A windows can be moved to any location");
WriteWindowLine("",Menus[3],2,W_Off,0,0,0,"on the screen by using the MOVEWINDOW");
WriteWindowLine("",Menus[3],3,W_Off,0,0,0,"statement......");
WriteWindowLine("",Menus[3],4,W_Off,0,0,0,"");
WriteWindowLine("",Menus[3],5,W_Off,0,0,0,"Each Time you press the Enter Key I will");
WriteWindowLine("",Menus[3],6,W_Off,0,0,0,"MOVE this window.. Press ESC to Quit");
PauseWindowUpdates(False);
S_HideMouse();
S_SetMouseEvent("00000000");
OpenWindow("",Menus[3]);
do
{
S_NextKey();
if (S_Enter)
MoveWindow("",Menus[3],random(18),random(40),'a');
}
while (!S_Esc);
EraseWindow("",Menus[3]);
PauseWindowUpdates(True);
S_ResetKeyFlags();
S_ResetMouseFlags();
S_SetMouseEvent("01000000");
S_ShowMouse();
};
void DragAWindow()
{
int Row = 3,Col = 10;
BuildOneWindow(3,Row,Col,40,6);
WriteWindowLine("",Menus[3],1,W_Off,0,0,0,"'DRAGGING' windows around on the screen");
WriteWindowLine("",Menus[3],2,W_Off,0,0,0,"is easy using the MOVEWINDOW statement");
WriteWindowLine("",Menus[3],3,W_Off,0,0,0,"and specifying rows and columns. Use the");
WriteWindowLine("",Menus[3],4,W_Off,0,0,0,"keypad keys to move this window or hold ");
WriteWindowLine("",Menus[3],5,W_Off,0,0,0,"the left mouse button down and drag it..");
WriteWindowLine("",Menus[3],6,W_Off,0,0,0,"------------ Pess ESC to Quit-----------");
PauseWindowUpdates(False);
OpenWindow("",Menus[3]);
do
{
S_NextKey();
if (S_Ms->MouseEvent)
{
S_SetMouseEvent("10100000");
S_AnalizeMouse();
do
{
MoveWindow("",Menus[3],S_MsRow,S_MsCol,'a'); /* a = Absolute screen location */
S_NextKey();
if (S_Ms->MouseEvent) S_AnalizeMouse();
}
while (!S_MsLeftReleased);
S_SetMouseEvent("01000000");
S_ResetMouseFlags();
}
else
{
Row = 0;
Col = 0;
if ((S_Up) || (S_PgUp) || (S_Home)) Row = -1;
if ((S_Down) || (S_PgDn) || (S_End)) Row = 1;
if ((S_Left) || (S_Home) || (S_End)) Col = -1;
if ((S_Right)|| (S_PgUp) || (S_PgDn)) Col = 1;
MoveWindow("",Menus[3],Row,Col,'r'); /* r = Relative screen location */
};
}while (!S_Esc);
EraseWindow("",Menus[3]);
PauseWindowUpdates(True);
S_ResetKeyFlags();
S_ResetMouseFlags();
}
void MoveSeveralWindows()
{
RandomWindows(10);
BuildOneWindow(13,20,1,78,3);
WriteWindowLine("",Menus[13],1,W_Off,0,0,0,
"Turbo ScrEdit allows you to perform many window functions concurrently on the");
WriteWindowLine("",Menus[13],2,W_Off,0,0,0,
"screen with one or more windows. Press Enter to see how smoothly 10 windows");
WriteWindowLine("",Menus[13],3,W_Off,0,0,0,
"can be moved at the same time.. <ESC> to exit <ENTER> for demo.");
PauseWindowUpdates(False);
for(X=3;X<14;X++)
OpenWindow("",Menus[X]);
do{
S_NextKey();
if (S_Ms->MouseEvent) S_AnalizeMouse();
if (S_Enter)
{
for (Z=0;Z<1;Z++)
{
for (Y=0;Y<20;Y++)
{
PauseWindowUpdates(True);
for (X=3;X<13;X++)
{
if ((X%4)==0) MoveWindow("",Menus[X],-1,0,'r');
if ((X%4)==1) MoveWindow("",Menus[X],0,-3,'r');
if ((X%4)==2) MoveWindow("",Menus[X],1,0,'r');
if ((X%4)==3) MoveWindow("",Menus[X],0,4,'r');
}
PauseWindowUpdates(False);
}
for (Y=0;Y<20;Y++)
{
PauseWindowUpdates(True);
for (X=3;X<13;X++)
{
if ((X%4)==0) MoveWindow("",Menus[X],1,0,'r');
if ((X%4)==1) MoveWindow("",Menus[X],0,4,'r');
if ((X%4)==2) MoveWindow("",Menus[X],-1,0,'r');
if ((X%4)==3) MoveWindow("",Menus[X],0,-3,'r');
};
PauseWindowUpdates(False);
}
}
}
ClearWindow("",Menus[13],0,0);
WriteWindowLine("",Menus[13],2,W_Off,0,0,0,
"Press ENTER again to repeat or ESC to exit back to the menu... ");
}while (!S_Esc);
for(X=3;X<14;EraseWindow("",Menus[X++]));
PauseWindowUpdates(True);
S_ResetKeyFlags();
S_ResetMouseFlags();
}
void WriteToWindowLines()
{
int Row;
char LineIn[255];
char Texts[255];
char PassStr[81];
S_HideMouse();
S_SetMouseEvent("00000000");
BuildOneWindow(3,19,1,78,4);
BuildOneWindow(4,10,1,78,6);
WriteWindowLine("",Menus[3],1,W_Off,0,0,0,
"Enter a line number and a itoaing of text to be written to the specified line");
WriteWindowLine("",Menus[3],2,W_Off,0,0,0,
"in the window above.. Press <ESC> to exit...................................");
WriteWindowLine("",Menus[3],3,W_Off,0,0,0,
"Line Number Text:");
WriteWindowLine("",Menus[4],1,W_Off,0,0,0,"1 -");
WriteWindowLine("",Menus[4],2,W_Off,0,0,0,"2 -");
WriteWindowLine("",Menus[4],3,W_Off,0,0,0,"3 -");
WriteWindowLine("",Menus[4],4,W_Off,0,0,0,"4 -");
WriteWindowLine("",Menus[4],5,W_Off,0,0,0,"5 -");
WriteWindowLine("",Menus[4],6,W_Off,0,0,0,"6 -");
OpenWindow("",Menus[3]);
OpenWindow("",Menus[4]);
PauseWindowUpdates(False);
S_SetCursor(S_BOLD);
do{
PassStr[0]=0;
ReadWindowField("",Menus[3],3,13,0,1,7,0,PassStr);
strcpy(LineIn,PassStr);
if (!S_Esc)
{
Row=atoi(PassStr);
if ((Row>0)&&(Row<7))
{
WriteWindowLine("",Menus[3],4,W_Off,0,0,0," ");
PassStr[0]=0;
ReadWindowField("",Menus[3],3,23,9,54,7,0,PassStr);
strcpy(Texts,LineIn);
strcat(Texts," - ");
strcat(Texts,PassStr);
WriteWindowLine("",Menus[4],Row,W_Off,0,0,0,Texts);
}
else
WriteWindowLine("",Menus[3],4,W_Off,0,RED,YELLOW,
"**** ERROR **** WindowField Must be in range of 1 to 6..");
}
}while (!S_Esc);
S_SetCursor(S_OFF);
EraseWindow("",Menus[3]);
EraseWindow("",Menus[4]);
S_ShowMouse();
S_SetMouseEvent("01000000");
PauseWindowUpdates(True);
S_ResetKeyFlags();
S_ResetMouseFlags();
}
void WritingWithScrolling()
{
char PassStr[81];
static char Message[14][51] =
{".................................................",
"With Turbo ScrEdit Windows you can turn on scrol-",
"ling and have a specified number of lines scroll ",
"up in the window before the new line is written. ",
"PRESS ENTER for a demonstration.",
"..................................................",
"Turbo ScrEdit Windows adds a new twist by allowing",
"you specify any number of lines in the window that",
"are to be scrolled DOWN in the window before the ",
"new line is written. PRESS ENTER to continue.",
"You can use these features to write and scroll",
"text independently in more than one area of a ",
"window at the same time.. You can even write to",
"more than one window at a time.. PRESS ENTER"};
S_HideMouse();
S_SetMouseEvent("00000000");
BuildOneWindow(3,8,1 ,50,14);
BuildOneWindow(4,4 ,12,50,14);
BuildOneWindow(5,1 ,24,50,14);
PauseWindowUpdates(False);
PopWindow ("",Menus[4]);
OpenWindow("",Menus[3]);
OpenWindow("",Menus[4]);
OpenWindow("",Menus[5]);
setmem(PassStr,80,32);
PassStr[80]=0;
for (X=0;X<6;X++)
{
PauseWindowUpdates(True);
WriteWindowLine("",Menus[3],14,W_Up,0,BLACK,WHITE,Message[X]);
WriteWindowLine("",Menus[4],14,W_Up,0,BLACK,WHITE,Message[X]);
WriteWindowLine("",Menus[5],14,W_Up,0,BLACK,WHITE,Message[X]);
PauseWindowUpdates(False);
};
S_NextKey();
for (X=0;X<8;X++)
{
PauseWindowUpdates(True);
setmem(PassStr,80,32);
setmem((char *)&PassStr[X],5,65+X);
WriteWindowLine("",Menus[3],14,W_Up,0,0,0,PassStr);
WriteWindowLine("",Menus[4],14,W_Up,0,0,0,PassStr);
WriteWindowLine("",Menus[5],14,W_Up,0,0,0,PassStr);
PauseWindowUpdates(False);
}
for (X=6;X<10;X++)
{
PauseWindowUpdates(True);
WriteWindowLine("",Menus[3],5,W_Up,3,BLACK,WHITE,Message[X]);
WriteWindowLine("",Menus[4],5,W_Up,3,BLACK,WHITE,Message[X]);
WriteWindowLine("",Menus[5],5,W_Up,3,BLACK,WHITE,Message[X]);
PauseWindowUpdates(False);
};
S_NextKey();
for (X=0;X<4;X++)
{
PauseWindowUpdates(True);
setmem(PassStr,80,32);
setmem((char *)&PassStr[X],5,65+X);
WriteWindowLine("",Menus[3],1,W_Down,0,0,0,PassStr);
WriteWindowLine("",Menus[4],1,W_Down,0,0,0,PassStr);
WriteWindowLine("",Menus[5],1,W_Down,0,0,0,PassStr);
PauseWindowUpdates(False);
}
for (X=9;X<14;X++)
{
PauseWindowUpdates(True);
WriteWindowLine("",Menus[3],9,W_Up,3,BLACK,WHITE,Message[X]);
WriteWindowLine("",Menus[4],9,W_Up,3,BLACK,WHITE,Message[X]);
WriteWindowLine("",Menus[5],9,W_Up,3,BLACK,WHITE,Message[X]);
PauseWindowUpdates(False);
}
S_NextKey();
for (X=0;X<45;X++)
{
setmem(PassStr,80,32);
setmem((char *)&PassStr[X],5,65+X);
PauseWindowUpdates(True);
WriteWindowLine("",Menus[3],4, W_Up, 4,0,0,PassStr);
WriteWindowLine("",Menus[3],11,W_Down,4,0,0,PassStr);
WriteWindowLine("",Menus[4],4, W_Up, 4,0,0,PassStr);
WriteWindowLine("",Menus[4],11,W_Down,4,0,0,PassStr);
WriteWindowLine("",Menus[5],4, W_Up, 4,0,0,PassStr);
WriteWindowLine("",Menus[5],11,W_Down,4,0,0,PassStr);
PauseWindowUpdates(False);
}
for (X=45;X>-1;X--)
{
setmem(PassStr,80,32);
setmem((char *)&PassStr[X],5,65+X);
PauseWindowUpdates(True);
WriteWindowLine("",Menus[3],4, W_Up, 4,0,0,PassStr);
WriteWindowLine("",Menus[3],11,W_Down,4,0,0,PassStr);
WriteWindowLine("",Menus[4],4, W_Up, 4,0,0,PassStr);
WriteWindowLine("",Menus[4],11,W_Down,4,0,0,PassStr);
WriteWindowLine("",Menus[5],4, W_Up, 4,0,0,PassStr);
WriteWindowLine("",Menus[5],11,W_Down,4,0,0,PassStr);
PauseWindowUpdates(False);
}
S_NextKey();
EraseWindow("",Menus[3]);
EraseWindow("",Menus[4]);
EraseWindow("",Menus[5]);
S_ShowMouse();
S_SetMouseEvent("01000000");
PauseWindowUpdates(True);
S_ResetKeyFlags();
S_ResetMouseFlags();
}
void ReadingWindowLines()
{
char PassStr[81];
S_HideMouse();
S_SetMouseEvent("00000000");
BuildOneWindow(3,5,1,30,11);
BuildOneWindow(4,5,50,30,11);
BuildOneWindow(5,18,20,40,4);
OpenWindow("",Menus[3]);
OpenWindow("",Menus[4]);
OpenWindow("",Menus[5]);
PopWindow("",Menus[4]);
PauseWindowUpdates(False);
textcolor(YELLOW);
textbackground(BLACK);
clrscr();
PassStr[28]=0;
for (X=0;X<10;X++)
{
setmem(PassStr,28,65+X);
cprintf("%s\r\n",PassStr);
}
SaveWindow();
PopWindow("",Menus[4]);
WriteWindowLine("",Menus[5],1,W_Off,0,0,0,"Each time you press the ENTER key I ");
WriteWindowLine("",Menus[5],2,W_Off,0,0,0,"will read a line of text from the ");
WriteWindowLine("",Menus[5],3,W_Off,0,0,0,"window on the RIGHT and write it to ");
WriteWindowLine("",Menus[5],4,W_Off,0,0,0,"window on the left.... ESC to EXIT");
X = -1;
do{
S_NextKey();
if (S_Enter)
{
X++;
if (X > 10)
{
ClearWindow("",Menus[3],0,0);
X = 0;
}
WriteWindowLine("",Menus[3],X+1,W_Off,0,0,0,
ReadWindowLine("",Menus[4],X));
}
}while (!S_Esc);
EraseWindow("",Menus[3]);
EraseWindow("",Menus[4]);
EraseWindow("",Menus[5]);
S_ShowMouse();
S_SetMouseEvent("01000000");
PauseWindowUpdates(True);
S_ResetKeyFlags();
S_ResetMouseFlags();
}
void ShuffleWindows()
{
char WorkStr[82], PassStr[81];
int FromWindow,
ToLevel;
S_HideMouse();
S_SetMouseEvent("00000000");
PauseWindowUpdates(False);
Z = 1;
for (X=3;X<9;X++)
{
itoa(X-2,PassStr,10);
strcpy(WorkStr,PassStr);
strcat(WorkStr,"╘═══════════╛ Window ");
strcat(WorkStr,PassStr);
strcat(WorkStr," ╘═══════════╛");
strcat(WorkStr,PassStr);
strcpy(WindowName,WorkStr);
WindowNamePos = 3;
strcpy(WindowFoot,WorkStr);
WindowFootPos = 3;
BuildOneWindow(X,Z*2,((Z-1)*6)+1,40,6);
itoa(X+1,PassStr,10);
WorkStr[0]=0;
strcat(WorkStr,"<");
strcat(WorkStr,PassStr);
strcat(WorkStr,"> --------------Level------------- <");
strcat(WorkStr,PassStr);
strcat(WorkStr,">");
WriteWindowLine("",Menus[X],1,W_Off,0,0,0,WorkStr);
WriteWindowLine("",Menus[X],6,W_Off,0,0,0,WorkStr);
Z++;
OpenWindow("",Menus[X]);
}
WindowName[0] = 0;
WindowNamePos = 0;
WindowFoot[0] = 0;
WindowFootPos = 0;
BuildOneWindow(9,21,1,78,2);
OpenWindow("",Menus[9]);
PauseWindowUpdates(False);
X = 1;
PassStr[0]=0;
do{
if (PassStr[0] > 0)
WriteWindowLine("",Menus[9],2,W_Off,0,RED,YELLOW,PassStr);
else
WriteWindowLine("",Menus[9],2,W_Off,0,0,0,PassStr);
if (X == 1)
{
PassStr[0]=0;
WriteWindowLine("",Menus[9],1,W_Off,0,0,0,
"ESC to EXIT or select the WINDOW to be pushed [ ]");
ReadWindowField("",Menus[9],1,49,0,2,7,0,PassStr);
FromWindow = atoi(PassStr);
if ((FromWindow>0)&&(FromWindow<7))
{
X=2;
FromWindow+=3;
PassStr[0]=0;
}
else
strcpy(PassStr,"*** ERROR *** Window number must be in range of 1..6");
}
if (X == 2)
{
PassStr[0]=0;
WriteWindowLine("",Menus[9],1,W_Off,0,0,0,
"Select the stack LEVEL where this window is to be inserted [ ]");
ReadWindowField("",Menus[9],1,62,0,2,7,0,PassStr);
ToLevel = atoi(PassStr);
if ((ToLevel>3)&&(ToLevel<10))
{
X=3;
PassStr[0]=0;
}
else
strcpy(PassStr,"*** ERROR *** Insert LEVEL must be in range of 4..9");
}
if (X == 3)
{
PauseWindowUpdates(True);
PushWindow("",FromWindow,ToLevel);
for (X=3;X<9;X++)
{
Y = WTable[X+1];
itoa(Y,PassStr,10);
WorkStr[0]=0;
strcat(WorkStr,"<");
strcat(WorkStr,PassStr);
strcat(WorkStr,"> --------------Level------------- <");
strcat(WorkStr,PassStr);
strcat(WorkStr,">");
WriteWindowLine("",Menus[X],1,W_Off,0,0,0,WorkStr);
WriteWindowLine("",Menus[X],6,W_Off,0,0,0,WorkStr);
}
PauseWindowUpdates(False);
PassStr[0]=0;
X = 1;
}
}while (!S_Esc);
for (X=3;X<10;EraseWindow("",Menus[X++]));
WindowName[0] = 0;
WindowNamePos = 0;
WindowFoot[0] = 0;
WindowFootPos = 0;
S_ShowMouse();
S_SetMouseEvent("01000000");
PauseWindowUpdates(True);
S_ResetKeyFlags();
S_ResetMouseFlags();
}
void PopWindowDemo()
{
char PassStr[81];
int FromWindow;
S_HideMouse();
S_SetMouseEvent("00000000");
PauseWindowUpdates(False);
Z = 0;
for (X=3;X<9;X++)
{
itoa(X-2,PassStr,10);
strcpy(WorkStr,PassStr);
strcat(WorkStr,"╘═══════════╛ Window ");
strcat(WorkStr,PassStr);
strcat(WorkStr," ╘═══════════╛");
strcat(WorkStr,PassStr);
strcpy(WindowName,WorkStr);
WindowNamePos = 3;
strcpy(WindowFoot,WorkStr);
WindowFootPos = 3;
BuildOneWindow(X,(Z+1)*2,((Z)*6)+1,40,6);
itoa(X+1,PassStr,10);
strcpy(WorkStr,"<");
strcat(WorkStr,PassStr);
strcat(WorkStr,"> --------------Level------------- <");
strcat(WorkStr,PassStr);
strcat(WorkStr,">");
WriteWindowLine("",Menus[X],1,W_Off,0,0,0,WorkStr);
WriteWindowLine("",Menus[X],6,W_Off,0,0,0,WorkStr);
Z++;
OpenWindow("",Menus[X]);
}
WindowName[0] = 0;
WindowNamePos = 0;
WindowFoot[0] = 0;
WindowFootPos = 0;
BuildOneWindow(9,21,1,78,2);
OpenWindow("",Menus[9]);
PauseWindowUpdates(False);
X = 1;
PassStr[0]=0;
do{
if (PassStr[0] > 0)
WriteWindowLine("",Menus[9],2,W_Off,0,RED,YELLOW,PassStr);
else
WriteWindowLine("",Menus[9],2,W_Off,0,0,0,PassStr);
if (X == 1)
{
PassStr[0]=0;
WriteWindowLine("",Menus[9],1,W_Off,0,0,0,
"ESC to EXIT or Select the window to be Popped [ ]");
ReadWindowField("",Menus[9],1,49,0,2,7,0,PassStr);
FromWindow = atoi(PassStr);
if ((FromWindow>0)&&(FromWindow<7))
{
X=1;
FromWindow+=3;
PassStr[0]=0;
}
else
strcpy(PassStr,"*** ERROR *** Window number must be in range of 1..6"); };
if (X == 1){
PauseWindowUpdates(True);
PopWindow("",FromWindow);
PopWindow("",Menus[9]);
for (X=3;X<11;X++)
{
Y = WTable[X+1];
itoa(Y,PassStr,10);
strcpy(WorkStr,"<");
strcat(WorkStr,PassStr);
strcat(WorkStr,"> --------------Level------------- <");
strcat(WorkStr,PassStr);
strcat(WorkStr,">");
WriteWindowLine("",Menus[X],1,W_Off,0,0,0,WorkStr);
WriteWindowLine("",Menus[X],6,W_Off,0,0,0,WorkStr);
}
PauseWindowUpdates(False);
PassStr[0]=0;
X = 1;}
}while (!S_Esc);
for (X=3;X<10;EraseWindow("",Menus[X++]));
WindowName[0] = 0;
WindowNamePos = 0;
WindowFoot[0] = 0;
WindowFootPos = 0;
S_ShowMouse();
S_SetMouseEvent("01000000");
PauseWindowUpdates(True);
S_ResetKeyFlags();
S_ResetMouseFlags();
}
void ChangingWindowBackGrounds()
{
char NewScreen[4000];
static char Texts[6][45] =
{" TURBO ╔══╗ (tm) ╔══╗ ╥ 1.6 ",
" ║ ║ ║ ─╥─ ",
" ╚══╗ ╔══╗ ╔══╗ ╠═ ╔══╣ ╥ ║ ",
" ║ ║ ╠═╦╝ ║ ║ ║ ║ ║ ",
" ╚══╝ ╚══╝ ╨ ╨ ╚══╝ ╚══╝ ╨ ╨ ",
" The professional`s screen developement tool "};
memset((char *)&NewScreen[0],176,4000);
X = 1;
do{
NewScreen[X] = 2;
}while ((X+=2) < 4002);
Y = 15;
Z = 0;
for(X=0;X<44;X++)
{
NewScreen[ (Y*160) +(X+19)*2] = Texts[0][X];
NewScreen[((Y+1)*160)+((X+19)*2)] = Texts[1][X];
NewScreen[((Y+2)*160)+((X+19)*2)] = Texts[2][X];
NewScreen[((Y+3)*160)+((X+19)*2)] = Texts[3][X];
NewScreen[((Y+4)*160)+((X+19)*2)] = Texts[4][X];
NewScreen[((Y+5)*160)+((X+19)*2)] = Texts[5][X];
}
S_HideMouse();
S_SetMouseEvent("00000000");
BuildOneWindow(3,22,1,78,2);
WriteWindowLine("",Menus[3],1,W_Off,0,0,0,
" Press ESC to exit or 'S' to swap screen backgrounds..");
PauseWindowUpdates(False);
OpenWindow("",Menus[3]);
X = 1;
do{
S_NextKey();
S_Ch = toupper(S_Ch);
if (S_Ch == 'S')
if (X == 1)
{
X = 2;
ChgWindowBackGround(NewScreen,3840);
}
else
{
X = 1;
ChgWindowBackGround((char *)&HoldScreen,3840);
};
}while(!S_Esc);
ChgWindowBackGround((char *)&HoldScreen,3840);
EraseWindow("",Menus[3]);
S_ShowMouse();
S_SetMouseEvent("01000000");
PauseWindowUpdates(True);
S_ResetKeyFlags();
S_ResetMouseFlags();
}
void StandardIO()
{
S_HideMouse();
S_SetMouseEvent("00000000");
BuildOneWindow(3,5,10,60,14);
PauseWindowUpdates(False);
OpenWindow("",Menus[3]);
strcpy(S_WorkStr,"***** Standard I/O *****");
S_SetCursor(S_BOLD);
do{
for (X=0;X<16;X++)
{
textcolor(X);
cprintf(" <%s>",S_WorkStr);
}
cprintf("\r\n");
cprintf("\r\n");
cprintf("...........................................................\r\n");
cprintf(" Type 'quit' to exit or type something and Press ENTER.\r\n");
cprintf("...........................................................\r\n");
S_WorkStr[0]=50;S_WorkStr[1]=0;
strcpy(S_WorkStr,cgets(S_WorkStr));
strcpy(WorkStr,S_WorkStr);
strupr(WorkStr);
gotoxy(strlen(S_WorkStr)+1,14);
cprintf("\r\n");
}while(strcmp(WorkStr,"QUIT")!=0);
S_SetCursor(S_OFF);
EraseWindow("",Menus[3]);
S_ShowMouse();
S_SetMouseEvent("01000000");
PauseWindowUpdates(True);
S_ResetKeyFlags();
S_ResetMouseFlags();
}
void FastVideoCheck()
{
if (!S_FastVideo)
{
WriteWindowLine("",Menus[1],1,W_Off,0,
ConfigRec.PopUpBarBg,
ConfigRec.PopUpBarFg,
" Fast video Mode is now <ON>");
S_FastVideo = True;
}
else
{
WriteWindowLine("",Menus[1],1,W_Off,0,
ConfigRec.PopUpBarBg,
ConfigRec.PopUpBarFg,
" Fast video mode is now <OFF>");
S_FastVideo = False;
}
}
void main()
{
S_Init();
textcolor(GREEN);
textbackground(BLACK);
clrscr();
gettext(1,1,80,25,HoldScreen);
randomize();
S_FastVideo = False;
S_Cursor = S_NORMAL;
S_Sound = False;
S_ShowStatus = False;
if (!WindowsInit())
{
strcpy(S_Msg," Insufficent memeory to use windows.. ");
S_NextKey();
exit(0);
}
Initialize();
MainOption = 0;
DemoOption = 1;
ColorOption = 1;
BuildMainMenu();
S_ActivateMouse();
S_SetMouseEvent("0100000");
S_ResetMouseFlags();
S_ShowMouse();
DoMouse = False;
WindowName [0] = 0;
WindowNamePos = 0;
WindowFoot[0] = 0;
WindowFootPos = 0;
OpenWindow("",Menus[0]);
do{
if (MainOption >= MenuBarItems) MainOption = 0;
if (MainOption < 0) MainOption = MenuBarItems-1;
strcpy(WorkStr,MenuBarFields[MainOption]);
WriteWindowField("",
Menus[0],
1,
(int)
((long)strstr(MenuBarStr,WorkStr))-
((long)&MenuBarStr),
9,
strlen(WorkStr),
ConfigRec.MenuLiteBg,
ConfigRec.MenuLiteFg,
0,
0,
WorkStr);
GetNextKey();
if (((S_Enter)||(S_Down))&&(MenuBarLines[MainOption] > 0))
WindowActive = True;
else
WindowActive = False;
if ((S_Enter)&&(MainOption==1))
DataEntryDemo();
if (WindowActive == True)
{
if (MainOption == 0)
{
PrevOption = 1;
LastLine = DemoOption;
}
if (MainOption == 2)
{
PrevOption = 2;
LastLine = ColorOption;
};
OpenWindow("",Menus[PrevOption]);
PauseWindowUpdates(True);
S_Enter = False;
do{
WriteWindowLine("",
Menus[PrevOption],
LastLine,
W_Off,
9,
ConfigRec.PopUpBarBg,
ConfigRec.PopUpBarFg,
ReadWindowLine("",Menus[PrevOption],LastLine));
if (MainOption == 0)
if (S_Enter)
switch (LastLine)
{
case 1 : {FastVideoCheck();break;}
case 2 : {OpenAndShutFiftyWindows();break;}
case 3 : {MoveAWindow();break;}
case 4 : {DragAWindow();break;}
case 5 : {MoveSeveralWindows();break;}
case 6 : {WriteToWindowLines();break;}
case 7 : {WritingWithScrolling();break;}
case 8 : {ReadingWindowLines();break;}
case 9 : {ShuffleWindows();break;}
case 10: {PopWindowDemo();break;}
case 11: {ChangingWindowBackGrounds();break;}
case 12: {StandardIO();break;}
}
if (MainOption == 2)
if (S_Enter) ChangeWindowDemo();
PauseWindowUpdates(False);
NewLine = 0;
GetNextKey();
PauseWindowUpdates(True);
WriteWindowLine("",
Menus[PrevOption],
LastLine,
W_Off,
1,
ConfigRec.PopUpTextBg,
ConfigRec.PopUpTextFg,
ReadWindowLine("",Menus[PrevOption],LastLine));
if (S_Up) LastLine--;
if (S_Down) LastLine++;
if (LastLine > MenuBarLines[MainOption])
LastLine = 1;
if (LastLine < 1)
LastLine = MenuBarLines[MainOption];
if (NewLine > 0) LastLine = NewLine;
}while(!((DoMouse)||(S_Alt)||(S_Left)||(S_Right)));
PauseWindowUpdates(False);
if (PrevOption == 2) DemoOption = LastLine;
if (PrevOption == 2) ColorOption = LastLine;
ShutWindow("",Menus[PrevOption]);
};
if (S_Left) MainOption--;
if ((S_Tab)||(S_Right)) MainOption++;
WriteWindowLine("",
Menus[0],
1,
W_Off,
0,
ConfigRec.MenuBarBg,
ConfigRec.MenuBarFg,
MenuBarStr);
}while(!((S_Enter)&&(MainOption==3)));
S_DisableMouse();
EraseWindow("",Menus[0]);
EraseWindow("",Menus[1]);
S_SetCursor(S_NORMAL);
}